<template>
  <div>
    <div>计算属性</div>
    <div>
      计算属性：
      {{ compBooksStr }}
    </div>
  </div>
</template>

<script setup lang="ts">
import { reactive, computed } from 'vue'

const author = reactive({
  name: 'aaa',
  books: ['金瓶梅', '水浒传', '西游记', '红楼梦']
})
const compBooksStr = computed(() => {
  return author.books.length > 1 ? author.books.join('-') : author.books[0]
})
</script>

<style></style>
